package com.ms.game.invitefriend.db;

import java.util.Calendar;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.ms.player.PlayerIdentityType;
import com.xpec.c4.db.model.basic.BasicModel;
import com.xpec.c4.game.time.TimeSys;

@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
@Table(name = "distributor_invite_codes")
@org.hibernate.annotations.Table(
		appliesTo = "distributor_invite_codes", indexes = 
		{
				@org.hibernate.annotations.Index(name = "IDX_INVITE_CODE", columnNames = { "inviteCode"}),
				@org.hibernate.annotations.Index(name = "IDX_DISTRIBUTOR_GUID", columnNames = { "distributorGuid"}),
				@org.hibernate.annotations.Index(name = "IDX_SUB_DISTRIBUTOR_GUID", columnNames = { "subDistributorGuid"})
		})
public class DistributorInviteCodesModel extends BasicModel{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3219902627045423995L;

	public DistributorInviteCodesModel() {
		eventTime = Calendar.getInstance();
		createTime = TimeSys.currentTimeMills();
	}
	
	private int id;
	
	/** 
	 * 紀錄時間
	 */
	private Calendar eventTime;
	
	/** 
	 * 遊戲時間
	 */
	private long createTime; 
	
	/**
	 * 邀請碼
	 */
	private String inviteCode;
	
	/**
	 * 經銷商ID
	 */
	private String distributorGuid;

	/**
	 * 子經銷商 ID
	 */
	private String subDistributorGuid;
	
	/**
	 * 子經銷商名稱
	 */
	private String subDistributorName;
	
	/**
	 * 下線ID
	 */
	private String downLineGuid;
	
	/**
	 * 下線名稱
	 */
	private String downLineName;
	
	/**
	 * 此邀請碼 是否被使用過了
	 */
	private boolean isUsed;
	
	private Date useTime;
	
	/**
	 * 邀請碼使用者類型
	 * @see PlayerIdentityType
	 */
	private byte identifyType;

	/**
	 * 邀請碼序號
	 */
	private int inviteCodeSn;
	
	/**
	 * 是否被作廢
	 */
	private boolean invalid;
	
	/**
	 * 作廢時間
	 */
	private Date invalidTime;
	

	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Calendar getEventTime() {
		return eventTime;
	}

	public void setEventTime(Calendar eventTime) {
		this.eventTime = eventTime;
	}

	public long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(long createTime) {
		this.createTime = createTime;
	}

	public String getInviteCode() {
		return inviteCode;
	}

	public void setInviteCode(String inviteCode) {
		this.inviteCode = inviteCode;
	}

	public String getDistributorGuid() {
		return distributorGuid;
	}

	public void setDistributorGuid(String distributorGuid) {
		this.distributorGuid = distributorGuid;
	}

	public String getSubDistributorGuid() {
		return subDistributorGuid;
	}

	public void setSubDistributorGuid(String subDistributorGuid) {
		this.subDistributorGuid = subDistributorGuid;
	}

	public String getSubDistributorName() {
		return subDistributorName;
	}

	public void setSubDistributorName(String subDistributorName) {
		this.subDistributorName = subDistributorName;
	}

	public String getDownLineGuid() {
		return downLineGuid;
	}

	public void setDownLineGuid(String downLineGuid) {
		this.downLineGuid = downLineGuid;
	}

	public String getDownLineName() {
		return downLineName;
	}

	public void setDownLineName(String downLineName) {
		this.downLineName = downLineName;
	}

	public boolean isUsed() {
		return isUsed;
	}

	public void setUsed(boolean isUsed) {
		this.isUsed = isUsed;
	}

	public byte getIdentifyType() {
		return identifyType;
	}

	public void setIdentifyType(byte identifyType) {
		this.identifyType = identifyType;
	}

	public int getInviteCodeSn() {
		return inviteCodeSn;
	}

	public void setInviteCodeSn(int inviteCodeSn) {
		this.inviteCodeSn = inviteCodeSn;
	}



	@Temporal(TemporalType.TIMESTAMP)
	public Date getUseTime() {
		return useTime;
	}

	public void setUseTime(Date useTime) {
		this.useTime = useTime;
	}

	public boolean getInvalid() {
		return invalid;
	}

	public void setInvalid(boolean invalid) {
		this.invalid = invalid;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getInvalidTime() {
		return invalidTime;
	}

	public void setInvalidTime(Date invalidTime) {
		this.invalidTime = invalidTime;
	}



}
